<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
		<title>资料修改</title>
		<link rel="stylesheet" href="__PUBLIC__css/reset.css" />
		<link rel="stylesheet" href="__PUBLIC__css/store.css" />
	</head>
	<body>
		<div class="layout">
			<!--header-->
			<div class="wrapper">
					<div class="header">
						<a class="s_preson" href="{:U('Users/index')}" target="_blank"> < </a>
						<div class="store">
							资料修改
						</div>
						<div class="s_index">
							<i class="s_icon s_indexBtn"></i>
						</div>
					</div>
			</div>


            <form action="{:U(Users/updateInfo)}" method="post" name="infoForm" onsubmit="return judge()">
			<div class="add-address info">
				<ul>
					<li><span>昵        称：</span><input type="text" class="addTips" name="nick" value="{$userInfo.nick}"  /></li>
					<li>
                        {$userInfo.brithday}
                        <span>生        日：</span>
                        <select id="sel_year" name="year">
                            <option value="{$userInfo.year}">{$userInfo.year}</option>
                        </select>
                        <select id="sel_month" name="month">
                            <option value="{$userInfo.month}">{$userInfo.month}</option>
                        </select>
                        <select id="sel_day" name="day">
                            <option value="{$userInfo.day}">{$userInfo.day}</option>
                        </select>
                    </li>
					<li>
                        <span>性        别：</span>
                        <input type="radio" id="radio-info-1" name="sex" class="radio" value="1" checked />
                        <label for="radio-info-1"><em></em> 男</label>
                        <input type="radio" id="radio-info-2" name="sex" class="radio" value="2" />
                        <label for="radio-info-2"><em></em> 女</label>
                    </li>
                    <script>
                        var aa={$userInfo.sex};
                        $("input[name='sex']").each(
                                function(){
                                    if($(this).val()==aa)
                                    {
                                        $(this).attr("checked","checked");
                                    }
                                }
                        );
                    </script>
                    <li><span>电        话：</span><input type="text" name="tel" class="addTips" value="{$userInfo.tel}"  /></li>
					<li><span>邮        箱：</span><input type="text" name="email" class="addTips" value="{$userInfo.email}"  /></li>
				</ul>
				<input type="submit" class="mian-address-btn" value="完成">
			</div>
            </form>
			<div class="footer">
				<p>©2015 北京食安城信息科技有限公司，并保留所有权利</p>
			</div>
		</div>
	</body>
</html>
<script type="text/javascript" src="__PUBLIC__js/jquery.min.js"></script>
<script type="text/javascript" src="__PUBLIC__js/zepto.min.js"></script>
<script type="text/javascript" src="__PUBLIC__js/birthday.js"></script>
<script>
    function judge()
    {
        if(document.infoForm.nick.val()=='')
        {
            alert('请输入昵称');
            document.infoForm.nick.focus();
            return false
        }else if(document.infoForm.day.val()=='')
        {
            alert("请选择生日");
            document.infoForm.day.focus();
            return false;
        }else if(document.infoForm.sex.val()=='')
        {
            alert("请选择性别");
            document.infoForm.sex.focus();
            return false;
        }else if(document.infoForm.tel.val()=='') {
            alert("请填写电话");
            document.infoForm.tel.val().focus();
            return false;
        }
        return false;
    }
	//表单获取焦点和失去焦点
//		var val;
//		$('input[type=text]').focus(function(){
//			val = $(this).val();
//			$(this).val('');
//		}).blur(function(){
//			$(this).val(val);
//		})
    $(function () {
        $.ms_DatePicker({
            YearSelector: ".sel_year",
            MonthSelector: ".sel_month",
            DaySelector: ".sel_day"
        });
        $.ms_DatePicker();
    });
</script>